Newbie question - XML version, searching by artist

Probably quite a common problems - apologies for newbie questions.
I've changed the URL of my MP3s in my XML to a new location and refreshed my feed. Is there a way of seeing what version of the XML iTunes is using? (it takes around 24 housr to refresh, right?)
Also, when I'm searching for my podcast by author it's not coming up (<channel><itunes:author>) - is there a reason for this or a way to get it to show up when people search for the artist, other than doubling it in the title? (This works by the way, but I'd prefer not to!)
Thanks.

you can do it in just one loop, going through all the image
tags in index_content and for each tag fill the values of all four
arrays
for (i...) {
get the appropriate child of index_content
first_array[ i ] = value of first tag
second_array[ i ] = value of second tag
no need for multiple loops.
flash has functionality for xml files, but it helps to write
a little wrapper around it, to simplify programming, especially if
you work with xml a lot.. I wrote my for work, so I can't show it
to you, but it's not very complicated to do

Similar Messages

  • XML newbie question - xml into arrays

    I am pretty new xml and I am working with a file that has
    text
    associated with images in the file and I would like to move
    the text
    into a xml document.
    I heard that a good way to deal with xml is to load it into
    an array. I
    have my text set up in arrays already, so my whole file
    aready works in
    that way. So all I have to do is load my xml document into my
    arrays. I
    have the xml document loading fine, but I don't know how to
    get the info
    into my arrays.
    My xml document looks like this:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <index_content>
    <image no="1">
    <imgLink>"pages/collection.html"</imgLink>
    <title>"Title 01"</title>
    <text>"Text bla bla, bla 01, Text bla bla, bla
    01"</text>
    <corner>"unisex"</corner>
    </image>
    <image no="2">
    <imgLink>"pages/collection.html"</imgLink>
    <title>"Title 02"</title>
    <text>"Text bla bla, bla 02, Text bla bla, bla
    02"</text>
    <corner>"men’s & women’s"</corner>
    </image>
    <image no="3">
    <imgLink>"pages/collection.html"</imgLink>
    <title>"Title 03"</title>
    <text>"Text bla bla, bla 03, Text bla bla, bla
    03"</text>
    <corner>"men’s & women’s"</corner>
    </image>
    <image no="4">
    <imgLink>"pages/collection.html"</imgLink>
    <title>"Title 04"</title>
    <text>"Text bla bla, bla 04, Text bla bla, bla
    04"</text>
    <corner>"men’s & women’s"</corner>
    </image>
    </index_content>
    My arrays in Flash are:
    var imgLinkURLs:Array = [];
    var imgTitles:Array = [];
    var imgTexts:Array = [];
    var imgCornerLabel:Array = [];
    So I think i need for loops pushing for example imgLink from
    image no1
    into imgLinkURLs array, then push imgLink from image no2, and
    so forth.
    Then do the same for imgTitle and the other arrays...
    How would I do this the right way?

    you can do it in just one loop, going through all the image
    tags in index_content and for each tag fill the values of all four
    arrays
    for (i...) {
    get the appropriate child of index_content
    first_array[ i ] = value of first tag
    second_array[ i ] = value of second tag
    no need for multiple loops.
    flash has functionality for xml files, but it helps to write
    a little wrapper around it, to simplify programming, especially if
    you work with xml a lot.. I wrote my for work, so I can't show it
    to you, but it's not very complicated to do

  • Newbie question on versions

    I'm just beginning my 30 day freebie and expect to ask for help and advice from time to time. This is a very knowledgeable and helpful group (and an important sales resource to Apple, Mr. Schorr).
    I think I understand the Aperture concepts of Digital Master File and Versions well enough as they apply to new work loaded into Aperture. However, I have a portfolio full of "versions" of my original digital images--different edits made for different purposes--scattered in dozens of folders. That's one reason I'm drawn to Aperture--to bring order to my future work.
    As I import my existing files, is there any way to link these "edited versions" with my existing originals so they are understood by Aperture to be Versions? If there is not, does anyone have some advice as to a workable method to keyword or add metadata to help the linkage? I'd like to avoid reinventing the wheel.
    Thanks.

    Hi and welcome to the world of Aperture.
    The quick answer is No. However if you stack your images as they were all one image the stacking should put them together. Please remember that with aperture the original is not touched and the versions are really data files hence the size is a lot smaller than the original. This should (if you purchase it) make your life a lot better and less disk space used.
    Chris
    ps if you haven't seen this yet it is a good source of learning.
    http://homepage.mac.com/bagelturf/aparticles/workspace/workspace.html

  • Multiple version of JRE in company..How to manage? (newbie question)

    Greetings..this is a newbie question
    We have 48 versions of JRE running in on XP IE6 in our company.
    Some version beat up other JAVA applications.
    It's a mess.
    How can anyone manage this many versions?
    Can we consolidate down to a few versions?
    I saw some posts on changing the JRE dynamically or perhaps using a wrapper with a product from "sourceforge".
    Are these viable?
    Thanks in advance

    We have 48 versions of JRE running in on XP IE6 in
    our company.
    Some version beat up other JAVA applications.
    It's a mess.can you elaborate on how some versions "beat up" other apps?
    How can anyone manage this many versions?you don't, each computer should periodically upgrade (IMO) but you shouldn't care. if you do, tell your users to load the latest version
    Can we consolidate down to a few versions?sure
    I saw some posts on changing the JRE dynamically or
    perhaps using a wrapper with a product from
    "sourceforge".
    Are these viable?i have no idea what this is, but I have doubts about your problem, if it exists at all

  • Unix version of Netweaver Dev Studio, Newbie question

    Hi,
    I have a very silly newbie question.  Is there a unix version of netweaver developer studio and if so what is the path to the executable?
    Thanks in advance
    John

    I don't think so.  NWDS is built on top of Eclipse which is an open source project by IBM.   Check out there site.
    http://www.eclipse.org/
    As of right now,  I don't believe that SAP is offering a Unix version and I doubt that they will.
    Regards,
    Rich Heilman

  • How to get the customized page's xml version ?

    Hi All,
    I have created some fields (of style 'MessageChoice', 'MessageLovInput') through personalization in a page and after that i navigated to the middle-tier where our MDS repository holding all the page's source file (in form of XXXXPG.xml) to get the updated version of the same page in xml version.
    But i couldn't get the latest version of page's XML file instead i found the old standard file only.
    Please help me in getting the file and guide me the path if it got stored somewhere in the architecture.
    Thank You,
    Thiyagarajan

    Dear Anoop,
    Thanks for your immediate response.
    Could you please pour your ideas how to store the custom personalizations in Unix box through Functional Administrator responsibility ?
    And one more question is as you said it will be stored in the form of xml but i have searched the page in the middle tier where it(standard one) got stored, but unable to find any one. How to find the xml file after doing the personalizations and in which path ?
    Waiting for your reply.
    Thank You,
    Thiyagarajan

  • How to store XML and search within tags

    My question
    ===========
    exactly what steps do you need follow to take an XML doc, store
    it, and query based on a tag value.
    The 8i Intermedia text option Reference refers to
    XLM_SECTION_GROUP feature. However, no examples are given. There
    is no user guide.
    I searched Oracle's website and found one reference to
    XML_SECTION_GROUP. The example given is a single row insert into
    a CLOB column with a single pair of tags.
    This whitepaper gives an example of an XML doc, and a query on
    it:
    XML Support in Oracle8i and Beyond
    November 9, 1998
    It doesn't list the steps in between storing the doc and quering
    it. This is crucial to the whole thing: does XML_SECTION_GROUP
    allow all nested tags below the top level to be sectioned and
    indexed implicitly? Or do you need to tell Oracle about all the
    tags you are interested in, in which case what value is added by
    the XLM_SECTION_GROUP?
    Does Oracle have some better examples on this?
    Below is text cut and pasted from the whitepaper.
    -----------x---------
    Figure 5: InsuranceClaim Mixes Structured Data and Text
    <?xml version="1.0"?>
    <InsuranceClaim>
    <ClaimID>12345</ClaimID>
    <LossCategory>7</LossCategory>
    <Settlements>
    <Payment>
    <Payee>Borden Real Estate</Payee>
    <Date>12-OCT-1998</Date>
    <Amount>200000</Amount>
    <Approver>JCOX</Approver>
    </Payment>
    </Settlements>
    <DamageReport>
    A massive <Cause>Fire</Cause> ravaged the building
    and
    <Casualties>12</Casualties> people were killed.
    Early
    FBI reports indicate that <Motive>arson</Motive> is
    suspected.
    </DamageReport>
    </InsuranceClaim>
    Once instances of iFS file types (including XML-based ones) are
    stored in the database, their
    content can be searched using standard SQL queries, and these
    files can be organized, browsed,
    and versioned using familiar tools like the Windows Explorer.
    So an insurance agent sees a
    directory of InsuranceClaim files sheFs recently worked on in
    the field, while an
    InsuranceClaim-processing application developer can work with
    the information in the
    InsuranceClaim in any way he needs to.
    XML-Enabled "Section Searches" in ConText
    Any XML documents or document fragments saved into "text blobs"
    in the database can be
    enabled for indexing by Oracle8i InterMediaFs ConText
    text-search engine. ConText has been
    enhanced for Oracle8i to allow developers to pinpoint their
    searches to a particular section of a
    document, where sections are implicitly defined by the XML tags
    in the document (fragment).
    Since ConText is seamlessly integrated into the database and
    the SQL language, developers can
    use SQL to perform queries that involve both structured data
    and indexed document fragments.
    For example, Figure 6 shows the SQL statement you would write
    to search one million
    Insurance Claims in your database to answer the question, "How
    much money has Jim Cox
    approved to date in settlement payments for arson-related fire
    claims? "
    Figure 6: Searching on a Column & Text in XML
    Sections
    SELECT SUM(Amount)
    FROM Claim_Header ch,
    Claim_Settlements cs,
    Claim_Settlement_Payments csp
    WHERE csp.Approver = 'JCOX'
    AND CONTAINS (DamageReport, 'Arson WITHIN Motive') >
    0
    AND CONTAINS (DamageReport, 'Fire WITHIN Cause' ) >
    0
    AND . . . /* Join Clauses */
    null

    Geoff Ingram (guest) wrote:
    : My question
    : ===========
    : exactly what steps do you need follow to take an XML doc,
    store
    : it, and query based on a tag value.
    : The 8i Intermedia text option Reference refers to
    : XLM_SECTION_GROUP feature. However, no examples are given.
    There
    : is no user guide.
    : I searched Oracle's website and found one reference to
    : XML_SECTION_GROUP. The example given is a single row insert
    into
    : a CLOB column with a single pair of tags.
    : This whitepaper gives an example of an XML doc, and a query on
    : it:
    : XML Support in Oracle8i and Beyond
    : November 9, 1998
    : It doesn't list the steps in between storing the doc and
    quering
    : it. This is crucial to the whole thing: does XML_SECTION_GROUP
    : allow all nested tags below the top level to be sectioned and
    : indexed implicitly? Or do you need to tell Oracle about all
    the
    : tags you are interested in, in which case what value is added
    by
    : the XLM_SECTION_GROUP?
    : Does Oracle have some better examples on this?
    : Below is text cut and pasted from the whitepaper.
    : -----------x---------
    : Figure 5: InsuranceClaim Mixes Structured Data and Text
    : <?xml version="1.0"?>
    : <InsuranceClaim>
    : <ClaimID>12345</ClaimID>
    : <LossCategory>7</LossCategory>
    : <Settlements>
    : <Payment>
    : <Payee>Borden Real Estate</Payee>
    : <Date>12-OCT-1998</Date>
    : <Amount>200000</Amount>
    : <Approver>JCOX</Approver>
    : </Payment>
    : </Settlements>
    : <DamageReport>
    : A massive <Cause>Fire</Cause> ravaged the building
    : and
    : <Casualties>12</Casualties> people were killed.
    : Early
    : FBI reports indicate that <Motive>arson</Motive> is
    : suspected.
    : </DamageReport>
    : </InsuranceClaim>
    : Once instances of iFS file types (including XML-based ones)
    are
    : stored in the database, their
    : content can be searched using standard SQL queries, and
    these
    : files can be organized, browsed,
    : and versioned using familiar tools like the Windows
    Explorer.
    : So an insurance agent sees a
    : directory of InsuranceClaim files sheFs recently worked on
    in
    : the field, while an
    : InsuranceClaim-processing application developer can work
    with
    : the information in the
    : InsuranceClaim in any way he needs to.
    : XML-Enabled "Section Searches" in ConText
    : Any XML documents or document fragments saved into "text
    blobs"
    : in the database can be
    : enabled for indexing by Oracle8i InterMediaFs ConText
    : text-search engine. ConText has been
    : enhanced for Oracle8i to allow developers to pinpoint their
    : searches to a particular section of a
    : document, where sections are implicitly defined by the XML
    tags
    : in the document (fragment).
    : Since ConText is seamlessly integrated into the database and
    : the SQL language, developers can
    : use SQL to perform queries that involve both structured data
    : and indexed document fragments.
    : For example, Figure 6 shows the SQL statement you would
    write
    : to search one million
    : Insurance Claims in your database to answer the
    question, "How
    : much money has Jim Cox
    : approved to date in settlement payments for arson-related
    fire
    : claims? "
    : Figure 6: Searching on a Column & Text in XML
    : Sections
    : SELECT SUM(Amount)
    : FROM Claim_Header ch,
    : Claim_Settlements cs,
    : Claim_Settlement_Payments csp
    : WHERE csp.Approver = 'JCOX'
    : AND CONTAINS (DamageReport, 'Arson WITHIN Motive') >
    : 0
    : AND CONTAINS (DamageReport, 'Fire WITHIN Cause' ) >
    : 0
    : AND . . . /* Join Clauses */
    Currently you cannot break apart an arbitrary XML doc and store
    it into the database without using XSLT to create DDL to insert
    it. You can create a schema and have XML be read and written to
    it. Check out the XML SQL Utility available here for download.
    As for the section searching, in 8.1.5 you can only get section
    searching not hierarchical searches. interMedia in this version
    doesn't understand the XML structure. This will come in 8.1.6.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • JSF newbie question - ServletException - Method not found

    I just started learning JSF (and JSP) by following the tutorial:
    JSF for nonbelievers: Clearing the FUD about JSF
    http://www-128.ibm.com/developerworks/library/j-jsf1/
    I'm getting a ServletException and I'm not sure why. Instead of starting the tutorial over, I'd like to learn what I'm doing wrong.
    The exception is:
    exception
    javax.servlet.ServletException: Method not found: [email protected]()
    root cause
    javax.el.MethodNotFoundException: Method not found: [email protected]()In the calculator.jsp page (a simple page with two form fields), I noticed that when I type CalcBean., my IDE (NetBeans) only autocompletes the class variables and neither of the methods (add and multiply). I quickly searched and someone suggested restarting the server. This did not fix my problem. I must be doing something completely wrong or I missed something in the tutorial. If you don't mind, please read the simple files below and see if you can spot anything wrong. Please keep in mind this is my first time using JSF (and JSP for that matter). If you can suggest a better newbie tutorial, please do! Thanks
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <context-param>
            <param-name>com.sun.faces.verifyObjects</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.validateXml</param-name>
            <param-value>true</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
        </context-param>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
    </web-app>
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
      <managed-bean>
        <description>
                    The "backing file" bean that backs up the calculator webapp
                </description>
        <managed-bean-name>CalcBean</managed-bean-name>
        <managed-bean-class>secondapp.controller.CalcBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <navigation-rule>
        <from-view-id>/calculator.jsp</from-view-id>
        <navigation-case>
          <from-outcome>success</from-outcome>
          <to-view-id>/results.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
    </faces-config>
    secondapp.controller.CalcBean.java
    package secondapp.controller;
    import secondapp.model.Calculator;
    * @author Jonathan
    public class CalcBean {
        private int firstNumber;
        private int secondNumber;
        private int result;
        private Calculator calculator;
        /** Creates a new instance of CalcBean */
        public CalcBean() {
            setFirstNumber(0);
            setSecondNumber(0);
            result = 0;
            setCalculator(new Calculator());
        public String add(int a, int b) {
            result = calculator.add(a,b);
            return "success";
        public String multiply(int a, int b) {
            result = calculator.multiply(a,b);
            return "success";
        // <editor-fold desc=" Accessors/Mutators ">
        public int getFirstNumber() {
            return firstNumber;
        public void setFirstNumber(int firstNumber) {
            this.firstNumber = firstNumber;
        public int getSecondNumber() {
            return secondNumber;
        public void setSecondNumber(int secondNumber) {
            this.secondNumber = secondNumber;
        public int getResult() {
            return result;
        public void setCalculator(Calculator calculator) {
            this.calculator = calculator;
        // </editor-fold>
    secondapp.model.Calculator
    package secondapp.model;
    * @author Jonathan
    public class Calculator {
        /** Creates a new instance of Calculator */
        public Calculator() {
        public int add(int a, int b) {
            return a+b;
        public int multiply(int a, int b) {
            return a*b;
    calculator.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
        <head><title>Calculator Test</title></head>
        <body bgcolor="white">
            <h2>My Calculator</h2>
            <f:view>
                <h:form id="calcForm">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="First Number" for="firstNumber" />
                        <h:inputText id="firstNumber" value="#{CalcBean.firstNumber}" required="true" />
                        <h:message for="firstNumber" />
                        <h:outputLabel value="Second Number" for="secondNumber" />
                        <h:inputText id="secondNumber" value="#{CalcBean.secondNumber}" required="true" />
                        <h:message for="secondNumber" />
                    </h:panelGrid>
                    <h:panelGroup>
                        <h:commandButton id="submitAdd" action="#{CalcBean.add}" value="Add" />
                        <h:commandButton id="submitMultiply" action="#{CalcBean.multiply}" value="Multiply" />
                    </h:panelGroup>
                </h:form>
            </f:view>
        </body>
    </html>

    In the future, please add some line breaks so I don't have to scroll horizontally to read your post.
    The problem is that the CalcBean.add/.multiply method is requiring two parameters. This method should be parameter-less. When talking about action methods, they should return String and not take any parameters.
    So, remove the parameters. You collect a firstNumber and a secondNumber from the user. These are the numbers you want to add (or multiply). Use those values (instead of the parameters) to calculate the result.
    The code changes aren't too complicated. I'd write them out for you, but you seem interested in learning (which is great by the way!). Let me know if you need more help on this.
    CowKing
    ps - I see more problems with the code, and I haven't given you all the answers. I know, I'm mean. You'll learn better if you try to fix things on your own first. I've just given you enough info to overcome the immediate issue. =)

  • DB XML version 2.5.13, php 5.2.10

    Not sure what the problem is, but I'm not getting the XML content with this piece of code:
    function getXmlDocumentByNameAsStringV1($documentName, $containerName){
    $container = $this->mgr->openContainer($containerName);
    $xmlDocument = $container->getDocument($documentName);
    $xmlDocument->fetchAllData();
    $content = $xmlDocument->getContent();
    $documentName = $xmlDocument->getName();
    echo "doc name= [$documentName]";
    print $xmlDocument->getContent();
    unset ($container);
    return $content;
    I basically created a wrapper class around the DB XML api.
    I was trying to get the full XML content as a string with this function, but all I seem to get is just a reference.
    I ended up doing a query on it instead to get me the getContent() call to get what I needed (which was full XML document with the document version and DOCTYPE refernces), but was wondering what I was doing wrong with this approach.
    Also when I was inserting XML documents into the Oracle Berkely DB XML database that referenced a DTD the database seemed
    to switch to a validate mode even though I did not turn on validation when either creating the container or opening the container.
    Is there a way to overide what appears to be a valdiation mode when the document refernces a DTD?
    I am running PHP 5.2.10 under Apache 2.2.14 with the binary release of DB XML version 2.5.13
    I figured out that I had to put my DTD in the [Apache Root] directory for it to validate properly. Stuff I read
    through the forums suggested that I needed to put the DTD at the root of where the databases are when
    referencing a DTD with just a file name without any reference to file:/// etc.. or http://
    I changed my home directory to a certain location:when I instantiated the
    $env = new Db4Env();
    $env->open($this->homeDirectory, $this->flagsDbEnvOpen)
    In any case the work around for now is to just put the DTD in the location that it expects which is the Apache Root install directory.
    It is a minor inconvenience, but thought I would mention it for others that may have run into this problem.
    (I used the Process Monitor searching on my DTD name to discover the solution to where Oracle DB XML or rather Apache Web server, I suppose through the dlls
    was expecting to find it)
    Also it appears that the binary versino works with PHP 5.2.10 of apache. I did not need to recompile the code with the new apache version.
    Is there any thing I should be worried about?
    Also I was getting the following error:
    // the code commented out below was an attempt to try and do a sub query from a valid XmlValue object.
    // was unsuccesful. starting receiving errors such as
    ////[25-Nov-2009 15:24:26] PHP Fatal error: Uncaught exception 'xmlexception' with message 'Error: Sequence does not match type document-node() - found item of type element(APP_Test_Script, {http://www.w3.org/2001/XMLSchema}untyped) [err:XPTY0004], <query>:1:12' in C:\htdocs\app1\BackEnd.php:82
    // Will attempt to reprocess xml into a php DOm node and extract out value that way, just to get something working.
    // $subQuery = "//*";
    // $categoryQContext = $this->mgr->createQueryContext();
    // $categoryQuery = $this->mgr->prepare($subQuery, $categoryQContext);
    // $testScriptValue = $AppScriptAsXmlValue->asString();
    // echo $testScriptValue;
    // echo "hello world";
    // $categoryResults = $categoryQuery->execute($testScriptAsXmlValue, $categoryQContext);
    // $categoryValue = null;
    // while($categoryResults->hasNext()){
    // $node = $categoryResults->next();
    // $categoryValue = $node->asString();
    Basically, I was trying to do a sub xquery from an initial xquery that returned a sequence of XML documents. According to the example in book The Definiitive Guide to Bekrely DB XML
    it should have worked, but wasn't.
    I also ran into an issue where I seemed to have locked up a container when I was editing an XML document in Oxygen and saving it back to the DB XML container from within Oxygen.
    after that action it wouldn't return from the save function and I coudln't ever load up that container. Even trying to access the contain from the command line dbxml it wasn't able to access
    that container again. I ended up having to blow it away from lack of knowledge on how to recover from that. If anyone has run into this and/or has some suggestions on this it would be nice.
    I'm guessing could it be because I had some meta data values defined in some of these documents that I was updating. From Oxygen, can you create metadata? I dont think you can, at least it wasn't obvious to me except perhaps fro the name of the document (which is implicitly a meta data tag).

    Hi,
    You'll have to compile yourself for different PHP API versions.
    Regards,
    George

  • Newbie in XML

    Hi All,
    i have just started with java xml programming. I am trying to parse a simple document using DOM parser, and i have a few doubts.
    My xml file is :
    =========
    <?xml version="1.0"?>
    <personal_info>
    <!-- This sample document contains my personal information-->
    <name>
    <fname>Ashish</fname>
    <lname>Srivastava</lname>
    </name>
    <age>23</age>
    <company>Oracle India Pvt. Ltd.</company>
    <phone type="office">+91-40-55394676</phone>
    <phone type="mobile">+91-40-32410638</phone>
    </personal_info>
    Parsing using DOM :
    ==============
    public class DOM1{
    public static void main(String args[]){
    try
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse("file:///e:\\java\\xml\\sample.xml");
    Element root = doc.getDocumentElement();
    System.out.println("Root name,value,type => "+root.getNodeName()+" -> "+root.getNodeValue()+" -> "+root.getNodeType());
    for (Node child=root.getFirstChild();child != null; child=child.getNextSibling()){
    int type=child.getNodeType();
    System.out.println("Child name,val,type :- "+child.getNodeName()+" -> "+child.getNodeValue()+" -> "+child.getNodeType());
    System.out.println("After Main");
    }catch (Exception ex) {
    System.out.println("Exception : "+ex); }
    The o/p i get is :
    ===========
    Root name,value,type => personal_info -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- #comment -> This sample document contains my personal information -> 8
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- name -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- age -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- company -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- phone -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    Child name,val,type :- phone -> null -> 1
    Child name,val,type :- #text ->
    -> 3
    After Main
    My question is :
    * Where does the '#text' come from? It appears for all the nodes
    * Why dont the actual value for a node get displayed? (like if nodeName is 'age' the value shud be '23', but is not displayed)?
    Thanks in advance,
    Ashish

    #text nodes are the empty text nodes.
    If the XML document is modified to remove space between the nodes, the #text nodes would not be generated.
    For example XML document:
    <personal_info><name><fname>Ashish</fname><lname>Srivastava</lname>
    </name></personal_info>
    would not generate #text nodes.
    To obtain the value of the text in a node
    Node node;
    String nodeValue=node.getFirstChild().getNodeValue();

  • ?xml version="1.0"? tag not appearing as first characters in document

    Hi,
    JSP below successfully creates a XML document but it includes a blank line before the <?xml version="1.0"?> tag.
    This causes my PL/SQL to return a "ORA-20100: Error occurred while parsing: PI names starting with 'xml' are
    reserved." error when using the XMLPARSER package.
    I am outputting the XML to IE5.0 but even if I do a SYSTEM out I get the same blank line before the initial tag.
    There are posts on here that confirm the PI error is caused by the tag not being the first characters in the document, but no solution/fix is provided.
    Any ideas much appreciated.
    JSP Code
    <%@ page import="java.sql.*, oracle.jbo.*, oracle.jdeveloper.cm.*, oracle.jdbc.*,oracle.xml.sql.query.*" %>
    <%String driver="oracle.jdbc.driver.OracleDriver";
    Driver d = new oracle.jdbc.driver.OracleDriver();
    String dbURL="jdbc:oracle:thin:@localhost:1521:mydb";
    String login="i2k";
    String password="fred";
    Connection cn = null;
    cn = DriverManager.getConnection(dbURL,login,password);
    // SQL Statement from URL Parameters
    String sql = request.getParameter("sql");
    if(sql == null){
    sql = "select * from vfi_trans";
    // Create SQL-to-XML Handler
    OracleXMLQuery q = new OracleXMLQuery(cn, sql);
    // Use <TransactionList> as document element for Rowset
    q.setRowsetTag("TransactionList");
    // Use <Transaction> for each row in the result
    q.setRowTag("Transaction");
    // set encoding
    q.setEncoding("iso-8859-1");
    // ensure lower case element names
    q.useLowerCaseTagNames();
    // Generate XML results and write to output
    String xmldoc = q.getXMLString();
    out.println(xmldoc.trim());
    //System.out.println(xmldoc.indexOf("\n"));
    cn.close();%>
    PL/SQL
    PROCEDURE XML_HANDLER2 IS
    -- MODIFICATION HISTORY
    -- Person Date Comments
    vfiURL VARCHAR2(100);
    parser xmlparser.Parser;
    vfiXML xmldom.DOMDocument;
    transactions xmldom.DOMNodeList;
    transactions_found NUMBER;
    curNode xmldom.DOMNode;
    textChild xmldom.DOMNode;
    v_itrans_site vfi_trans.itrans_site%TYPE;
    BEGIN
    dbms_output.put_line('Integrator 2000 Transactions');
    -- This is the URL to browse for an XML-based vfi feed of stories on XML
    vfiURL := 'http://10.1.1.111:7070/i2k25_html/ShowQuery.jsp?sql=select%20*%20from%20vfi_trans';
    -- Set the machine to use as the HTTP proxy server for URL requests
    http_util.setProxy('MYPROXY');
    -- Parse the live XML vfi feed from Moreover.com by URL
    parser := xmlparser.newParser;
    vfiXML := xml.parseURL( vfiURL );
    xmlparser.freeParser(parser);
    -- Search for all <headline_text> elements in the document we recieve
    transactions := xpath.selectNodes(vfiXML,'/TransactionList/ITRANS_ID');
    -- Loop over the "hits" and print out the text of the title
    FOR j IN 1..xmldom.getLength(transactions) LOOP
    -- Get the current <headline_text> node (Note the list is zero-based!)
    curNode := xmldom.item(transactions,j-1);
    -- The text of the title is the first child (text) node of
    -- the <headline_text> element in the list of "hits"
    -- textChild := xmldom.getFirstChild(curNode);
    v_itrans_site := xpath.valueof(curNode, '.');
    dbms_output.put_line('('| |LPAD(j,2)| |') '| | v_itrans_site);
    END LOOP;
    -- Free the XML document full of vfi stories since we're done with it.
    xml.freeDocument(vfiXML);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END; -- Procedure
    null

    Charles,
    I believe that the blank line is caused by the JSP engine when it strips out the '<%@ page import...>' (replace bracket with brace) statement. God (or at least Larry E) forgive me for posting a link at IBM, but this article speaks to your issue:
    http://www-106.ibm.com/developerworks/library/j-dynxml.html?dwzone=ibm
    Maybe you need to put the <?xml?> tag in the jsp itself and strip it out of your xmldoc before outputting it.
    Good luck.

  • Some newbie questions

    dear all smart men, i am a newbie in xml domain, there are some quiestions that i can't make sense yet, anyone can help:
    1. dose the xml is independent from protocals? we can bind xml to http and sock too, and something this kind of?
    2. soap is called a "protocol", but in fact it's a kind of xml application with standard format. we all know that xml is used for describing data, and soap has this functionality too, but why soap is isolatable from common xml? what is its purpose?
    3. jxta is a set of protocols used for p2p purpose. most of these protocols are also used in xml, but how they get their goals. For exmaple the ERP protocol in JXTA, it can route the routine the message transimited. but it seems the network protocol can achieve, how the xml can do this? (i have read some docs about this i can't make sense about it yet)
    all above are some questions i met by now, for i am a newbie in this field, so i may have some misunderstading about xml/soap/jxta, if any pls feel free to critise, that i can step further =).
    Thanx, and good luck to you all.

    Thanx Dodossot =)!
    your answers are quite helpful really, now i feel the cloud dispersed already.
    about the 3rd question, for you have answer the first and second, the third is not a problem now. what i need is to read more about JXTA protocols. if you are interested about them, you may find some docs at www.jxta.org for more inf.
    at last i will say thanx again, and you don't hesitate to say you'r smart =).
    best regards.

  • Printing ?xml version=\"1.0\" encoding=\"UTF-8\"? at the top of my xml

    Can anyone spot where I'm going wrong?
    I'm creating a DOMDocument like this:
    Document document = null;
    DocumentBuilder doc_builder = null;
    try
         doc_builder = factory.newDocumentBuilder();
    catch(ParserConfigurationException e){/* deal with exception*/}
    document = doc_builder.newDocument();Adding various stuff to it, then saving it like this
    Source source = new DOMSource(document);
    Result result = new StreamResult(idx);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.METHOD, "xml");
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //??????
    xformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
    xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    xformer.transform(source, result);All the usual stuff.
    But how do I get it to write:
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    at the top of the page?
    One further thing...
    If I have nothing to write in my xml file, it just spits out a blank file.
    Instead, I want it to write:
    <?xml version="1.0" encoding="UTF-8"?>
    <upIdx/>
    a simple:
    document.createElement("upIdx");doesn't appear to do anything if the block "upIdx" is subsequently empty.
    Many thanks

    duugggh....
    (well it is friday evening.. ... long week.. all that kind of stuff)
    how stupid of me....
    to answer my own question, it was here:
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); //??????
    xformer.setOutputProperty(OutputKeys.VERSION, "1.0");
    xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

  • Remove ?xml version="1.0" encoding="UTF-8"?   from XML doc

    I have generated an XML file using javax XML transformer. In the XML file thats generated I have the version and the encoding line
    <?xml version="1.0" encoding="UTF-8"?>
    which is automatically generated in my XML file. Is there any way that I can avoid that from the XML file thats generated.
    Here is the transformer that I have used.
    public static void printToXML(String fileName){
               try{
                    File file = new File(fileName);
                    Transformer tr = TransformerFactory.newInstance().newTransformer();
                    tr.setOutputProperty(OutputKeys.INDENT, "yes");
                    tr.setOutputProperty(OutputKeys.METHOD,"xml");
                    tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
                    tr.transform( new DOMSource(dom),new StreamResult(new FileWriter(file)));
               }catch(TransformerConfigurationException tcex){
                    logger.info("TransformerConfigurationException at printToXML method in CSVtoXML.java");
                    logger.error("TransformerConfigurationException", tcex);
               }catch(TransformerException tex){
                    logger.info("TransformerException at printToXML method in CSVtoXML.java");
                    logger.error("TransformerException", tex);
               }catch(IOException ioex){
                    logger.info("IOException at printToXML method in CSVtoXML.java");
                    logger.error("IOException", ioex);
          }

    Well, it is a pretty important line. Why do you need it removed? Anything that really processes XML knows how to read it and determine what encoding was used. That is vital, if you look at the number of questions posted here about foreign language text in XML. If you really have a text processsor that knows how to open a file called something.xml, and knows how to process or ignore most of the pointy bracket things, but not this one, it is time to fix it.
    Dave Patterson

  • The wsdll file less of ?xml version="1.0"?

    Today I created webservice with NWDS. I successfully created the webservice and I can see it through http://localhost:50000/wsnavigator.  But when I viewed the wsdl of the service, I found the wsdll file less of <?xml version="1.0"?>. You konw, as an xml file it must has this header to prove it is an xml file. I used NW7.1 and followed the "Creating the HelloWorld Web Service" help document. It is on http://help.sap.com/saphelp_nwce10/helpdata/en/46/917a26cf75581ce10000000a1553f7/frameset.htm
    My question is why the WSDL less of <?xml version="1.0"?>. Is it a bug of NW, or I did something wrong when I created the WS?
    Thanks & Regards

    Hi Glen,
    Interesting Find.
    There are two very interesting things to note:
    1. The WSDL URL : http://localhost:50000/HelloService/HelloBean?wsdl
    Plz. note the "?" in the url. This kind of approach is mostly used to pass parametres to servlets.
    2. The Following is the HTTP Log of the Service call.
    POST /HelloService/HelloBean HTTP/1.1          // Pst method call confirms finding no 1
    Host: localhost:50000
    Content-Type: text/xml; charset=utf-8
    Connection: close
    Content-Length: 368
    SOAPAction: ""
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><yq1:sayHello xmlns:yq1='http://sap.com/tutorial/helloworld/'><name>Gaurav Modgil</name></yq1:sayHello></SOAP-ENV:Body></SOAP-ENV:Envelope>
    It seems that the server is using some Java App/servlet to read the Application Program and produse the result as XML, So maybe the strict adherence to XML was not required in this case.
    Note the Last Line where the version information is also passed along with other parametres.
    The Result output is a generated XML given below.
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
        <ns2:sayHelloResponse xmlns:ns2="http://sap.com/tutorial/helloworld/">
          <return>Hello, Gaurav Modgil.</return>
        </ns2:sayHelloResponse>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    So my Conclusion is "There is no bug in NW7.1 :)....."
    Hope you Agree
    Thanks and regards,
    Gaurav
    Edited by: Gaurav Modgil on May 15, 2008 4:52 PM

Maybe you are looking for

  • CSS Gallery IE problem

    Hi, I'm building a CSS gallery for my friend for his company site, however, the gallery works fine in Firefox but in IE theres an issue where the image that appears on hover appears behind the other images instead of on top. heres the link to the pag

  • Enhancement Pack 2 impact on ESS for ECC 6.0

    We are planning to upgrade one of our systems (evaluation system) from EA-HR 600 to EA-HR 602 (Enhancement Pack 2 SP2) There's some ongoing ESS configurations (just ESS) on this evaluation system. What is the impact of an Enhancement Pack 2 import/up

  • Oracle 10g multi node installation

    Hi, Multi node installation for Oracle 10g Appl Server - Node A: Install core business Database server. - Node B: Install Application Server Infrastructure (OID, repository database). - Node C: Install Application server middle tier (forms, reports,

  • SCCM Report Top Console User Computer by User Collection

    Trying to Get a report of where We can have a user collection then it comes back with that users computer information... I have this report working until I try to have it run by user collection.  I have commented out the last join and where  and the

  • Rescue and Recovery to an other system

    After a (total) breakdown of my ThinkPad T60, I want to get some files to my substitution system (a Lenovo R61i). The R&R was made to an external HDD. The support of Lenovo has said, that Recovery is only possible to the same system, from which the R