小编xVi*_*Vir的帖子

从Node实例获取完整的xml文本

我用Java读取了这个代码的XML文件:

File file = new File("file.xml");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);

NodeList nodeLst = doc.getElementsByTagName("record");

for (int i = 0; i < nodeLst.getLength(); i++) {
     Node node = nodeLst.item(i);
...
}
Run Code Online (Sandbox Code Playgroud)

那么,我如何从节点实例中获取完整的xml内容?(包括所有标签,属性等)

谢谢.

java xml

8
推荐指数
1
解决办法
5401
查看次数

Windows Phone分析 - 解析日志失败

我是内存分析Windows Phone应用程序的新手.停止内存分析会话后,Visual Studio会尝试解析日志,并使用"解析日志文件失败"消息进行故障转移.我看到%temp%目录中的"ProfilerLog_"文件并收到此消息:

System.ArgumentException: Item has already been added. Key in dictionary: '226295856'  Key being added: '226295856'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Collections.Hashtable.Add(Object key, Object value)
   at SilverlightProfiler.Internal.CFAdapter.HandleEvent(UInt32 eventID, ProbeMarkerType eventMarkerType, Double clockTime, Double threadTime, UInt32 threadID, ThreadType threadType, List`1 eventInfoList)
   at SilverlightProfiler.Internal.WPInputAdapter.HandleEvent(ProbeEventSource eventSource, UInt32 eventID, ProbeMarkerType eventMarkerType, Double clockTime, Double threadTime, UInt32 threadID, ThreadType threadType, List`1 eventInfoList)
   at SilverlightProfiler.Internal.WPInputAdapter.HandleEvent(BinaryReader input, Int64 endOffset, ThreadStreamInfo threadStreamInfo)
   at SilverlightProfiler.Internal.WPInputAdapter.HandleEvents()
   at SilverlightProfiler.Internal.WPInputAdapter.ParseLogFile(BinaryReader input, String logFilename, AgLogFileHeader header)
   at SilverlightProfiler.Internal.WPInputAdapter.Parse(Object data) …
Run Code Online (Sandbox Code Playgroud)

memory-profiling visual-studio windows-phone-7

5
推荐指数
1
解决办法
563
查看次数

SpeechRecognizer在第一次侦听时抛出onError

在Android 5中我遇到了奇怪的问题.startListening对SpeechRecognizer 的第一次调用导致错误代码为7的错误(ERROR_NO_MATCH).

我使用以下代码制作了测试应用程序:

if (speechRecognizer == null) {

    speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
    speechRecognizer.setRecognitionListener(new RecognitionListener() {
        @Override
        public void onReadyForSpeech(Bundle bundle) {
            Log.d(TAG, "onReadyForSpeech");
        }

        @Override
        public void onBeginningOfSpeech() {
            Log.d(TAG, "onBeginningOfSpeech");
        }

        @Override
        public void onRmsChanged(float v) {
            Log.d(TAG, "onRmsChanged");
        }

        @Override
        public void onBufferReceived(byte[] bytes) {
            Log.d(TAG, "onBufferReceived");
        }

        @Override
        public void onEndOfSpeech() {
            Log.d(TAG, "onEndOfSpeech");
        }

        @Override
        public void onError(int i) {
            Log.d(TAG, "onError " + i);
        }

        @Override
        public void onResults(Bundle bundle) { …
Run Code Online (Sandbox Code Playgroud)

android speech-recognition speech

5
推荐指数
3
解决办法
6514
查看次数

WP8仿真器屏幕尺寸

我已将我的WP7应用程序迁移到WP8平台.现在,如果我开始在WXGA仿真器中调试我的应用程序(屏幕大小应为768×1280).我有 Host.Content.ActualWidth=480Host.Content.ActualHeight=800.

这是正常的行为吗?为什么WXGA仿真器的屏幕尺寸为480x800?

emulation screen-size windows-phone-8

4
推荐指数
1
解决办法
5284
查看次数