CRLF not as text node

How do I make the parser not to consider CRLF as text node?
I'm having trouble using getFirstChild() method if I parse an XML that looks like
<xml>
<Animals>
<Animal>
</Animal>
</Animals>
</xml>
The documentElement's(<xml>) firstChild expects to be <Animals>, but instead it is a text node which I believe is CRLF.
If I rewrite the XML in one line (with no CRLF) then firstChild is <Animals> as expected.
Any suggestion
Thanks

Hi the parser adds a TextNode for every new line (and even if you have only a space between two tags, it should be added) , this caused because the parser don't know if you want to read this information's.
It's quite confusing, than normally you would expect this to be the node value, but it isn't!
The node value by is normally null.
See
http://java.sun.com/j2se/1.4.1/docs/api/org/w3c/dom/Node.html
for more information.
Use getChildNodes and iterate trough them until you get a none TextNode.
The NodeList knows:
getLength()
item (int)
which is enough for a for loop.
Or if you know the name of the child, you can use:
getElementsByTagName(String name).item(0);
Hope this helps.
Greetings Michael

Similar Messages

  • The text which is in text node is not displaying in output in smartforms

    Hi,
      In smartforms i created a text node and entered some text like following.
         Target Quantity               60000001     60000002          
         Scheduled Quantity               60000003     60000004               
         So far delivered Quantity          60000005     60000006
         Last delivered Quantity          60000007     60000008
          Delivery Schedule Details
    the text which i entered as above in the text node is not displaying.It is in main area.

    Hi
    if u are using table or template inside the main window
    then just mention the position of the text element
    goto text element - output options- output structure tab----give line and column no.
    Thanks
    krushna

  • Text node not showing first line?

    I'm trying to figure out some unexpected behavior with the layout of Text. If I create an example program based on the API documentation
    http://java.sun.com/javafx/1.2/docs/api/javafx.scene.text/javafx.scene.text.Text.html
    Like so:
    Stage
        title: "Application title"
        width: 500
        height: 500
        scene: Scene
            content: [ Text {font: Font { size: 20 } content: "First row\nSecond row" }  ]
    }The resulting screen only shows "Second row", the first line is moved out of the screen above. I need to set y to 20 to show the first line.
    Is that normal?

    Right, Text nodes have an textOrigin, which is default set to the base line. That means that y=0 is just below the letters.
    But the behavior is unexpected when simply adding a Text node and nothing is visible.

  • In SMARTFORMS when openee a Text Node,   Giving a Short Dump

    Hi
    I am getting Short Dump in SMARTFORMS Transaction, when ever I opened a Text Node and made some changes in it.
    With out opening a Text Node I can able to change and activate the SmartForm.
    But if I open a Text Node I can able to make changes in the Text Node but later if i click on any other Node, it is giving a Short Dump.
    But all other systems in my office are working fine.
    I have tried the Utilities->Settings-> and changed the editor also. 
    I have also Installed the SAPGUI once again for this Issue. But still I am getting the same problem.
    Can anyone Please help me on this Issue.
    I am sending the error enalysis of the Short Dump.
    Error analysis
        Short text of error message:
        Control Framework : Error processing control
        Long text of error message:
         Diagnosis
             An error occurred when the system tried to process the commands
             from the Automation Queue on the presentation server.
             There are several possible reasons for this:
             - The installation of the SAP GUI on the presentation server is
             faulty or obsolete.
             - There is an error in the application program
             - There is an error in the SAPGUI or an integrated control
         Procedure
             1. Make sure that you have imported the appropriate Support
             Package, the current kernel, and GUI patch for the release of your
             system
             2. Check whether the error occurs locally on one or a few PCs, or
             generally on all PCs. Note whether the error only occurs for some
             users, for example because of a specific Customizing setting.
             If it only occurs locally, this suggests an installation problem
             with the PC. Check the installation; if necessary, reinstall the
             software. In the dump, search for the SY-MSGLI field, since it may
             point to the cause of the error.
             3. Activate the Automation Trace (in accordance with SAP Note
             158985).
             4.Start the transaction and continue until the screen immediately
             before the dump.
             5. From the System -> Utilities menu, choose Autom. Queue,
             Synchronous Processing.
             The status bar of the GUI displays the text:
                "Automation synchron flush mode on"
             6. If you now proceed with the application, the short dump will
             display the ABAP call that caused the error; the Automation Trace
             will contain the error on the presentation server.
             7. If necessary, load the short dump and trace files on to
             sapservX, so that SAP can analyze them.
        Technical information about the message:
        Message class....... "CNDP"
        Number.............. 006
    Thanks in Advance.

    Hi
    I think dump is because of SAP GUI. If you are ECC 6.0 then install SAP GUI 710 with patch level  2 or more and check
    Regards
    Shiva

  • Account dimension hierarchy text nodes ACCTYPE property

    Hello,
    We have master data being populated into BPC from BW. So for the Account dimension in BPC, we use the 0GL_ACCOUNT infoobject in BW. This infoobject also has all the Financial statement version hierarchies which are being loaded to BPC. The question that I have is, how should the hierarchy text node values for ACCTYPE property be populated if I have to automate this load on a daily basis.
    For the actual GL accounts, we have the account number ranges defined. Like 1* series accounts are Assets etc..So we can easily define a rule for populating the ACCTYPE  property values. But not sure if there is any easy logic for populating the hierarchy text nodes as we dont have any pattern in them. Would we need to maintain it manually always?
    Thanks
    Gaurav

    Hello Richard,
    If there is really no logic behind them there is off course no way of automating this. Then I guess you will have to maintain each node separately.
    Some customers are also willing to change their text node structure. For example I had one when where the rules for the 0HIER_NODE records were as follows:
    *           EXP -> Starts with 32*, 311*, 312*, 321*, 3111*, 3112*,
    *                  3142*,  31111*,  31112*,  311111*
    *           INC -> Starts with TOT, 3000000000, 3100000000, 313*,
    *                  322*, 3113*, 3141*, 31113*, 311112*
    *           AST -> Starts with 1*
    *           LEQ -> Starts with 2*
    Kind regards,
    Christophe

  • How to import hierarchy text node from BW infoobject

    I tried to import hierarchy from BW InfoObject through process chain /CPMB/IMPORT_IOBJ_HIER.
    But BPC complains the hierarchy text node haven't been dimension member.
    As result, I have to export the hierarchy text node to a flat file and import again which is not convenient.
    Does anyone have some best practice for this?
    Thank you.

    Hi,
    You can follow the steps mentioned in the below How-to-Guide of sdn. This explains the steps to be implemeted to inport hierarchies.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c02d0b47-3e54-2d10-0eb7-d722b633b72e
    Hope this helps.
    Rgds,
    Poonam

  • How to include std text(Created in So10) in text node?

    Hello,
    How to include the Standard Text( created in So10 ) into Text Node.
    I had typed the Standard text name in the TEXT NAME : ZXXX
          Text Object : TEXT
           TEXT ID : ST
          LAnguage : &CONTROL_PARAMETERS-LANGU&
    But, I am unable to look at that particular text in the smart form. I am receiving an error message : "UNable to load the data into front end. ....etc"
    It is taking me away to the initial screen.
    PLz help!
    ANy suggestion will be appreciated.
    REgards,
    Kittu

    I need to include the Standard text created in so10 into a text node in the Smart form.
    In samrt form, I had created a Text Node.
    In General attributes from the Drop Down menu
    --> I had selected INClude Text
    --> It has asked me TExt name : ZXXX (Name of the STD text create din so10)
                         Text Obje : TExt
                         Text ID   : ST
                         Language  : &CONtrol_Parameters-LANGU&
               It is even activated without any errors. But, it does not display the Text written in the Standard Text. Is there any way that I can include the Standard text into the  Text node.......
    ANy suggestions will be appreciated...
    REgards,
    Kittu

  • XML parser fails to convert html encoded text nodes

    Under the strain of large documents this defect rears its ugly head more often. While parsing a text node containing html encoded chars i.e. < > &; etc...
    The parser will seemingly forget to change the chars at random, 99.9% of the time everything is ok and the proper conversions take place:
    < -> &#60;
    > -> >
    &; -> &#38;
    Once an error occurs it is reproducible until the text node is changed ( values and/or order ) then it is a crapshoot again.
    These tests were done using the default UTF-8 encoding, here is the exception thrown by the parser along with a portion of the text node before and after the first parsing.
    Let me be clear, the parser actually succeeds the first time but the transformation of the HTML encoded pieces possibly fails. It is on the parsing of the text node value as its own document that the parser fails.
    Error 0 : Error parsing XML string! Line :: 1, Column :: 65674
    Error 1 : End tag does not match start tag 'Project'.
    End tag does not match start tag 'Project'.
    at oracle/xml/parser/v2/XMLError.flushErrors (XMLError.java:233)
    at oracle/xml/parser/v2/NonValidatingParser.parseDocument (NonValidatingParser.java:248)
    at oracle/xml/parser/v2/XMLParser.parse (XMLParser.java:117)
    at pacificedge/xml/XMLUtilities.loadParserFromString (XMLUtilities.java:104)
    Preprocessing ::
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    <StartDate>1998-08-10</StartDate>
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    Post processing:
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    <StartDate>1998-08-10</StartDate> <-- Error is raised here when the value of the text node is used as an xml document
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    Please investigate this. It is a chronic problem for us and possibly many others.
    null

    Sorry for the encoding issues in the message before here are the pertinent pieces hope this shows up correctly.
    &;lt; -> &;#60;
    &;gt; -> >
    &;amp; -> &;#38;
    Preprocessing ::
    &;lt;Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213"&;gt;
    &;lt;StuffA&;gt;100213&;lt;/StuffA&;gt;
    &;lt;Name&;gt;I am a Name&;lt;/Name&;gt;
    &;lt;StartDate&;gt;1998-08-10&;lt;/StartDate&;gt;
    &;lt;FinishDate&;gt;2000-06-30&;lt;/FinishDate&;gt;
    &;lt;Path&;gt;Folder1\Folder2&;lt;/Path&;gt;
    &;lt;/Project&;gt;
    Post processing:
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    &;lt;StartDate>1998-08-10</StartDate> <-- Error is raised here when the value of the text node is used as an xml document
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    null

  • Master Data load does not extract Hierarchy nodes in BPC Dimension ACCOUNT

    Hi Experts,
    I am performing master data load through standard DM package with Filter selection as:
    1. Chart of Accounts
    2. Hieararchy selection has 4 hierarchy names
    3. Selected Import Text nodes
    4. Selected Set Filters by Attribute OR Hierarchies
    I have run this DM package for a set of data and selections a week ago and it worked fine.
    However when i run it now, it is giving issues,
    It extracts any new GL maintained in the BI system however it does not extract any hierarchy nodes at all! (Have tested this by deleting the hierarchy nodes and tried to run the master data load)
    I am running the DM package in Update and have selection as External.
    Any sugestions for checks / has anyone encountered this issue earlier?
    Regards,
    Shweta Salpe

    Hi Guyz,
    Thanks.
    I found that the issue was with the transformation file where i was maintaining the RATETYPE.
    When i removed the mapping of RATETYPE this works fine. (Pulls the nodes of hierarchies)
    however now i do not have Ratetype populated in the system.
    my rate type mapping is:
    RATETYPE=*IF(ID(1:1)=*STR(C) then *STR(TOSKIP);ID(1:1)=*STR(H) then *STR(TOSKIP);ID)
    and in conversion file i have TOSKIP     *skip
    I have to skip the ratetypes for the hierarchy nodes and my hierarchy nodes start with C and H.
    So now that i have removed the mapping for RATETYPE can anyone suggest me a correct way to achieve this? (Note the above mapping formula was skipping all of the hierarchy nodes starting with C and H)
    Regards,
    Shweta Salpe

  • #text nodes

    Hello,
    I am parsing xml document using xerces with schema validation on, without DTD.
    <xs:element name="variant">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ds:default"/>
    <xs:element ref="ts:answer"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    As I understand this element should be "element only": without #text nodes in the dom tree.
    But I get: #text default #text answer #text.
    Can I fix it?
    Thanks
    Justinas

    Do you have white space between the nodes? I believe you can tell the parser to ignore white space that is not required by the schema.

  • Child text node lost with newDomNode()

    Hello,
    I have a simple custom XMLBean compiled from a schema like:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://mydomain.com/xsd/myBean"
         xmlns="http://www.w3.org/2001/XMLSchema"
         xmlns:tns="http://mydomain.com/xsd/myBean"
         elementFormDefault="qualified">
         <simpleType name="MyType">
              <restriction base="double"/>
         </simpleType>
         <element name="MyElement" type="tns:MyType"/>
    </schema>
    An the Java code:
    import com.mydomain.xsd.myBean.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    void myMethod() {
    MyElementDocument bean = MyElementDocument.Factory.newInstance();
    bean.setMyElement(3.14d);
    // this prints the the xml with text including 3.14d
    System.out.println(bean.xmlText());
    Element dom = ((Document) bean.newDomNode()) .getDocumentElement();
    The problem is, after getting the DOM object my calling newDomNode(), the Text
    Node for "3.14d" is lost from the DOM tree; i.e. instead of
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean">3.14d</tns:MyElement>
    I get XML like:
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean" />
    Question: how come the DOM tree is not complete?
    Any help is very much appreciated.
    -Feng

    I fixed the error by upgrading xbean.jar to the one bundled with WebLogic Servcer
    8.1 SP2 (I originally had the version from WLS 8.1 SP1).
    -Feng
    "Feng Xue" <[email protected]> wrote:
    >
    Hello,
    I have a simple custom XMLBean compiled from a schema like:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://mydomain.com/xsd/myBean"
         xmlns="http://www.w3.org/2001/XMLSchema"
         xmlns:tns="http://mydomain.com/xsd/myBean"
         elementFormDefault="qualified">
         <simpleType name="MyType">
              <restriction base="double"/>
         </simpleType>
         <element name="MyElement" type="tns:MyType"/>
    </schema>
    An the Java code:
    import com.mydomain.xsd.myBean.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    void myMethod() {
    MyElementDocument bean = MyElementDocument.Factory.newInstance();
    bean.setMyElement(3.14d);
    // this prints the the xml with text including 3.14d
    System.out.println(bean.xmlText());
    Element dom = ((Document) bean.newDomNode()) .getDocumentElement();
    The problem is, after getting the DOM object my calling newDomNode(),
    the Text
    Node for "3.14d" is lost from the DOM tree; i.e. instead of
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean">3.14d</tns:MyElement>
    I get XML like:
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean" />
    Question: how come the DOM tree is not complete?
    Any help is very much appreciated.
    -Feng

  • When double clicking a word with an adjacent br Firefox is reporting the endContainer of the selected range as the parent div, but when selecting with a mouse drag Firefox reports the endContainer is a text node. Is this expected behavior?

    Double click on break and the end container appears to be the parent div, but if you select just break with mouse the end container is a text node. If you continue to drag your mouse past the end of break you also get the parent div. Sample html:<br />
    <br />
    <pre><nowiki><!doctype html>
    <html>
    <body>
    <div id="surroundingDiv1">
    Break<br/>
    </div>
    <p>
    <a href="#" onclick="showSelectionInfo()">Show Selection Info</a>
    </p>
    <label for="output"></label><textarea id="output" rows="20" cols="50"></textarea>
    <script>
    function showSelectionInfo() {
    var range = null;
    var sel = window.getSelection();
    if (sel.rangeCount > 0 && sel.getRangeAt(0).toString() != "") {
    range = sel.getRangeAt(0);
    if (range != null) {
    document.getElementById("output").innerHTML =
    "Text: " + range.toString() +
    "\n\nendContainer - " +
    "\n\tid: " + range.endContainer.id +
    "\n\tnodeName: " + range.endContainer.nodeName +
    "\n\tnodeValue: " + range.endContainer.nodeValue +
    "\n\tnodeType: " + range.endContainer.nodeType +
    "\n\nstartContainer - " +
    "\n\tid: " + range.startContainer.id +
    "\n\tnodeName: " + range.startContainer.nodeName +
    "\n\tnodeValue: " + range.startContainer.nodeValue +
    "\n\tnodeType: " + range.startContainer.nodeType;
    </script>
    </body>
    </html></nowiki></pre>

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • CDATA sections converted to text nodes by XMLDOM parser

    I have done a lot of reading, experimentation and openned a TAR on this. I am suprised nobody else has posted on the issue. The xmlparser.parseClob call appears to parse an XML document properly but converts CDATA sections into text nodes.
    For example take the following XML:
    <some><pnode><![CDATA[the <xml>]]></pnode></some>
    If I immediately write it back out using xmldom.writeToClob the resulting XML will be:
    <some>
    <pnode>the &amp;#60;xml></pnode>
    </some>
    For one I wish writeToClob wouldn't add whitespace (but that's another issue), but as you can see the CDATA node no longer exists, being replaced by an encoded text node.
    I wrote code to traverse the DOM outputting node types and even writing a similar printer to the writeToClob. The fact is there really is no CDATA node in the DOM after parsing. Instead the code which traverses the DOM identifies a single text node with CDATA text contained in it.
    In my opinion this is extremely odd default behavior and I cannot seem to work around it due to the fact that the DOM structure is not created properly by the parse. Please tell me that other people have ran into this behavior and I'm not just nuts? Better yet, please just tell me I'm doing something wrong and you have the answer...that would be kinder to my project schedule.
    If you like I have example code. I am using the xmldom API on Oracle 9.2.0.4.

    Thanks for the response Mark. I have gotten some feedback from my TAR as well. We are using version 9.2.0.*. I have since learned that this is a bug in the xmldom implementation based on Java. It has been recommended that I use the dbms_* packages as you suggested. I originally attempted to use the dbms_* packages (the C-based implementation) when following the tutorials and other documentation but for some reason we do not seem to have those packages installed. I was directed by my DBA's to use the other package as we both bevelieved it was just the same package in a different location. I am working with my DBA to get the C-based dbms_* packages installed.

  • Manipulating Text Nodes

    Hi,
    I have only recently begun working with XML and the DOM. I have
    begun writng a small app to upload XML data to a database using
    the version 2 parser. I am having trouble getting at the content
    of text nodes ( for example the "Stan" in <name>Stan</name> ). I
    have tried using the getNodeValue() function,and casting to a
    XMLText and the getData() function. I know I am at the correct
    node because I have used to the getNodeName() function to
    generate a list of nodes as I work my way through the document
    from the root. What am I missing?
    Thank you for your help,
    Stan Grabinski
    null

    Stan Grabinski (guest) wrote:
    : Hi,
    : I have only recently begun working with XML and the DOM. I
    have
    : begun writng a small app to upload XML data to a database
    using
    : the version 2 parser. I am having trouble getting at the
    content
    : of text nodes ( for example the "Stan" in
    <name>Stan</name> ). I
    : have tried using the getNodeValue() function,and casting to a
    : XMLText and the getData() function. I know I am at the
    correct
    : node because I have used to the getNodeName() function to
    : generate a list of nodes as I work my way through the document
    : from the root. What am I missing?
    : Thank you for your help,
    : Stan Grabinski
    You need to use the getNodeValue() method against the text node
    associated with the element node of interest not the element
    node itself. If this doesn't help, please post a code sample and
    the XML file.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Smartforms text node in release 710

    Prior to today, I have worked with SmartForms in ECC 5.0 but now I am in ECC 6.0.  I see a major difference in SmartForms when it comes to text nodes.  What is this all about?  I can no longer drag fiields to the text node.  Now the text node opens with an, embeded, instance of MS Word.  Is this normal?  Have SmartStyles gone away?  I am royally confused.
    Regards,
    Aaron

    The only pencil icon I see says "Editor" when you hover over it and it is above the 'Check' icon.  I used the 'Insert Field' icon, adding the '&'s, and it still doesn't display the result of that field.  Any ideas?
    I now managed to get the value to come through.  I had to click the "editor" button and add the field in that editor.  It didn't work if I added the field in the first editor (the node layout).
    My problem with the character format still stands.  Also, can you not drag and drop the fields anymore?  Is there a way to go back to the old editor?  This new editor takes entirely too long to load each time you go to a new text node.
    Aaron
    Edited by: Aaron Shover on May 7, 2008 11:12 AM

Maybe you are looking for

  • Cannot login with mobile account when server is switched off

    Hello all, First of all, my condolences to the Jobs family.  OK.  On with my problem.  I apologise in advance if this has been answered before.  I've trawlled through various boards and I can't seem to find an answer. I'll try to keep it brief. I've

  • My volume control is stuck

    I have a Mac Book Pro. The keyboard controller for my volume does not work. It is stuck on full blast and when I try to lower the white image comes up on the screen showing that it is fullblast with a white circle and and a line through it. Also, whe

  • Stopping execution of the script from the databank

    I'd like to provide control through the databank for the user to programmatically stop the script execution depending on certain real time conditions or data calculations. Does anyone have a sample VBA script example for the ThisJob object. Thanks.

  • Af:train across taskflows

    I have four jsff pages used with af:train tag. In a single taskflow all the four jsff pages flow is coming up fine and it works as expected. The requirement is i want to move each jsff page into a seperate taskflow and than have the same functionalit

  • ITEM_TYPE 'WFSTD' is protected, no changes were saved.

    Dear friends, When I use "WFLOAD $fndunpw 0 Y UPGRADE ./xxcub/import/FAAPPROV.wft |tee -a $LOGFILE" to upload a customization.The error message as follows: Should the Access level is too low.Need I change the access level using Oracle Workflow Builde