Affichage des articles dont le libellé est Active questions tagged xml - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Active questions tagged xml - Stack Overflow. Afficher tous les articles

samedi 9 mai 2015

there is an error in xml document (2 2) xmlns='' was not expected

The error I am getting is all over stackoverflow answered again and again, I have tried few changes in the code but not able to remove the error. here is the class I am using for serialization and deserialization. Please have a look at it.

I don't understand terms like XMLroot, XML element and namespace. So please answer accordingly, like what namespace should I give, what could be the XML root.

If u can edit it, it would be great:

namespace tudumo9
{

  public class data
  {
    public string project_name;
    public string note_text;
    public string tag_text;
    public DateTime start_date;
    public DateTime due_date;
    public string action;

    public  data(){}

  }
}

My XML:

<?xml version="1.0"?>
<ArrayOfData xmlns:xsi="http://ift.tt/ra1lAU" 
             xmlns:xsd="http://ift.tt/tphNwY">
  <data>
    <project_name>p1</project_name>
    <tag_text>tagged</tag_text>
    <start_date>0001-01-01T00:00:00</start_date>
    <due_date>0001-01-01T00:00:00</due_date>
    <action>Action</action>
  </data>
</ArrayOfData>

Exracting text from xml using R

This is the xml code part that I am working on: I need to extract some specific text from the xml code.

The xml code.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="CoreNLP-to-HTML.xsl" type="text/xsl"?>
<root>
  <document>    
    <dependencies type="collapsed-dependencies">//the collapsed-dependencies tag
                  <dep type="root">
                    <governor idx="0">ROOT</governor>
                    <dependent idx="8">provide</dependent>
                  </dep>
                  <dep type="mark">
                    <governor idx="2">requested</governor>
                    <dependent idx="1">If</dependent>
                  </dep>
        </dependencies>
    </document>
</root>

I would like the output in the following format:

root(ROOT-0,provide-8)
mark(requested-2,If-1)
advcl(provide-8,requested-2)
case(TD-4,by-3)

I am able to extract each of the parameter separately, but cannot take the whole thing out in one go.

abstracts <- xpathSApply(doc,"//*/dependencies[@type='collapsed-dependencies']",xmlValue) # finds the words within collapdsed-dependencies
abstracts #value
#"ROOTproviderequestedIfproviderequestedTDby"

type <- xpathSApply(doc, "//dependencies/dep", xmlGetAttr, 'type') #gives the types 
type #value
#[1] "root"       "mark"       "advcl"      "case"

idx1 <- xpathSApply(doc, "//dependencies/dep/governor", xmlGetAttr, 'idx') # gives the idx for governor
idx1 #value
#[1] "0"   "2"   "8"   "4"   "2"   "8"

# gives the idx for dependent
idx2 <- xpathSApply(doc, "//dependencies/dep/dependent", xmlGetAttr, 'idx') 

What is the meaning of ProjectTemplate tag in plugin.XML intellij?

I am new to intellij plugin development. I am studying on some plugins from repositories to start my project on developing an IDEA plugin. I need to create a new project wizard which is specific to my plugin. Thus I am using <extentions></extention> tags in plugin.xml. In some projects I went through, had <moduleBuilder> tag within them. But instead I found different tag like this.

 <projectTemplate projectType="MyApplication" templatePath="resources/filename.zip" category="true"/>

In this project there is no any "filename.zip" but works fine. This plugin creates a folder hierarchy after running which is like a template. Please can someone explain me about these tags? What is the difference between <projetTemplate> and <moduleBuilder> which are written within <extention></extention> tags?

iterating through all xml elements python

I have just started out using python (3+) and am trying to figure out how to extract all the elements from an XML file inc all the child nodes (so grand children and great grand children nodes etc if that makes sense) without doing a check after extracting every child. I cannot hardcode, as the xml file may change. I simply would like to extract the element, its parent element and if it has any children.

Any advice/help would be greatly appreciated.

Cap.

Obtain styled attributes for child from parent's style definition

The question title is probably nonsensical. I am creating a bunch of custom views that will be placed in a single parent layout - a custom FrameLayout.

These custom views have their own style attr which are set using the parent's style attr.

As an example, consider Parent to be the custom FrameLayout. Its style attr is defined in attrs.xml:

<attr name="parentStyleAttr" format="reference" />

The Child also has its attr:

<attr name="childStyleAttr" format="reference" />

And Parent defines its styleable attr as:

<declare-styleable name="Parent">
    <attr name="childStyleAttr" />
</declare-styleable>

Child's styleable attr:

<declare-styleable name="Child">
    <attr name="childBgColor" format="color" />
</declare-styleable>

Following this, I define a style for the parent:

<style name="ParentStyle">
    <item name="childStyleAttr">@style/ChildStyle</item>
</style>

and one for Child:

<style name="ChildStyle">
    <item name="childBgColor">@color/blah</item>
</style>

For Parent, I set up parentStyleAttr in the app's theme:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="parentStyleAttr">@style/ParentStyle</item>
</style>

Now, when Parent is created, it inflates a layout containing Child:

LayoutInflater.from(getContext()).inflate(R.layout.child, this, true);

During Child's initialization, I need to read the value of the style attribute set in @style/ChildStyle - childBgColor.

This doesn't work:

final TypedArray a = context.obtainStyledAttributes(attrs,
          R.styleable.Child, R.attr.childStyleAttr, R.style.ChildStyle);

The way I am currently reading attr/childBgColor is:

public Child(Context context, AttributeSet attrs, int defStyleAttr) {
    super(createThemeWrapper(context), attrs, defStyleAttr);
    initialize(attrs, defStyleAttr, R.style.ChildStyle);
}

private static ContextThemeWrapper createThemeWrapper(Context context) {
    final TypedArray forParent = context.obtainStyledAttributes(
            new int[]{ R.attr.parentStyleAttr });
    int parentStyle = forParent.getResourceId(0, R.style.ParentStyle);
    forParent.recycle();

    TypedArray forChild = context.obtainStyledAttributes(parentStyle,
            new int[]{ R.attr.childStyleAttr });
    int childStyleId = forChild.getResourceId(0, R.style.ChildStyle);
    forChild.recycle();

    return new ContextThemeWrapper(context, childStyleId);
}

void initialize(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    Context context = getContext();
    final Resources res = getResources();

    final TypedArray a = context.obtainStyledAttributes(R.styleable.Child);

    ....
}

I am not confident if this is the right approach. Can someone help shed some some light on this?

Run activity only once, then always run the main one

As the title says, Scenario is: On first time using the app, Show Screen A. Once you are done with screen A, the button will lead to you Screen B. From now on and forever, the Screen B will always be main "Screen"(Activity?) when you start the app. I am trying this 2 days and i can't get it. Somebody please explain a little detailed, or even better throw me a code.rar so i can research it. I'm going crazy with this!!!

Looking for advice on storing, reading, and dynamically updating data in XML file (C#)

I'm a bit of a newbie to C# and I've never done anything with XML. Most of my experience is C code written for microcontrollers, with some C/C++ and linux scripting experience, but never any XML.

Basically, I've got a bunch of firmware update files in a folder, currently about 50, but users could have as many as a hundred or more, especially if they don't delete old versions or the program gets expanded to support additional hardware. My program needs to check all those files, parse a little data out of them, and store it in some fashion for quick lookup. I thought about just doing a CSV file, but figured I might as well learn a little about XML in the process.

My first problem is formatting the data. One firmware file may cover multiple hardware models, and there can be multiple versions of the firmware for one model. When the program starts, it will need to make a list of all the file names currently in the XML file and compare them to those in the folder. Later it will need to find all the files with the right model name. I've come up with a couple different formats for storing the data, I'm currently leaning towards option 2, but I'd really appreciate an expert opinion.

Option 1:

<Model model="Model String">
    <FirmwareFile filename=foo.bar> 
        <Version> "1.2.3" </Version>
        <DateCode> "05082015" </DateCode>
    </FirmwareFile>
    <FirmwareFile filename=foo2.bar>
        [...]
    </FirmwareFile>
</Model>

Option 2:

<FirmwareFile filename=foo.bar> 
    <Models>"Model A", "Model B"</Models> //probably not the right way to do this
    <Version> "1.2.3" </Version>
    <DateCode> "05082015" </DateCode>
</FirmwareFile>

The other problem is which library and which method of retrieving the data would be best. The way I see it, I have two options for working with the file, either I read through it on the disk twice (the first time reading file names, the second time to look up model numbers) and write/delete entries from it directly, or else I read all the data once into memory (probably a list of a class), and if anything changes rewrite the file. Which way should I be going? And which library should I be using?

Thanks!

How to Modified or permanently delete Field in the DBGrid with Delphi?

how so that I can remove / modify fields in the DB Grid permanently? I use this code: NB : CDS = ClientDataSet DBG = DBGrid Database I use is *.xml

uses
  Windows, SysUtils, Forms, ExtCtrls, Buttons, DB, DBClient, DBGrids,
  Grids, Controls, StdCtrls, Dialogs, Classes;

type
  TForm1 = class(TForm)
        B2: TSpeedButton;
        B3: TSpeedButton;
        DS: TDataSource;
        CDS: TClientDataSet;
        DBG: TDBGrid;
        SD: TSaveDialog;
        RG: TRadioGroup;
        E1: TEdit;
        E2: TEdit;
        L1: TLabel;
        L2: TLabel;
        B1: TSpeedButton;
        B4: TSpeedButton;
        B5: TSpeedButton;
        OD: TOpenDialog;
    var
        FN, FDragOfs: Integer;
        FDragging: Boolean;

    procedure TForm1.FormShow(Sender: TObject);
    begin
       FN := 1;
       RG.ItemIndex := 0;
    end;

    on Button Create --->

    try
       FN := FN + 1;
       CDS.Active := false;
    with CDS.FieldDefs.AddFieldDef do
    begin
       Name := E1.Text;
    case RG.ItemIndex of
       0 :
    begin
       DataType := ftString;
       Size := StrToInt(E2.Text);
    end;
       1 :
       DataType := ftInteger;
    end;

    end;
       CDS.CreateDataSet;
       E1.Text := 'Field'+IntToStr(FN);
       RG.ItemIndex :=0;
    finally
       CDS.Active := True;
    end;

    on Button Export To File ---->

    if not SD.Execute then
       exit
    else
    begin
       CDS.SaveToFile(SD.filename,dfxml);
       CDS.Active := false;
       CDS.FileName := SD.FileName;

    on Button Delete --->

        CDS.Fields.Remove (DBG.Columns.Items [DBG.SelectedIndex] .Field);
        //DBG.Columns.Delete(DBG.SelectedIndex);
        DBG.Columns.RebuildColumns;

    DB Structur e.g like this : 

        <?xml version="1.0" standalone="yes"?> 
         <DATAPACKET Version="2.0">
        <METADATA>
        <FIELDS>
        <FIELD attrname="Number" fieldtype="i4"/>
        <FIELD attrname="Date" fieldtype="string" WIDTH="20"/>
        <FIELD attrname="Name" fieldtype="string" WIDTH="20"/>
        <FIELD attrname="Phone" fieldtype="string" WIDTH="20"/>
        <FIELD attrname="Address" fieldtype="string" WIDTH="20"/>
        <FIELD attrname="Manager" fieldtype="string" WIDTH="20"/>
        </FIELDS>
        <PARAMS/>
        </METADATA>
        <ROWDATA>
        </ROWDATA>
        </DATAPACKET>

so the question of how way I can remove / replace(rename or modified) with another name field that I do not want when Run-Time, i want to delete this line. example:

<FIELD attrname = "Date" fieldtype = "string" WIDTH = "20" />

after I remove Field does not appear, but when I took my application and re-run the database load sa'at back again as before.

sorry about my English.

Android Manifest mismatched tag

i've been trying to open an existing Android project but i get an error on its Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
package="com.one.piano"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="17" />

<application

    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.evilduck.piano.PianoDemoActivity"
        android:label="@string/app_name" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

The error is:

Error:(25, -1) Android Resource Packaging: [custom_view_keyboard-master] C:\Users\user\Desktop\oneapp.idea\AndroidManifest.xml:25: error: Error parsing XML: mismatched tag

which seems to be on the last "activity" on the previous line of the last.

Any ideas?

How to write Xpath

This is the HTML in tabular format.

<tr><td style="width: 150px;">Development Name:</td><td><b>Bellewoods</b></td></tr>

<tr><td style="width: 150px;">Property Type:</td><td><b>Executive Condominium</b></td></tr>

<tr><td style="width: 150px;">Developer:</td><td><b>Qingjian Realty (Woodlands) Pte Ltd</b></td></tr>
                                                                                        <tr><td style="width: 150px;">Tenure:</td><td><b>99-year Leasehold</b></td></tr>
                                                                                            <tr><td style="width: 150px;"># of Floors:</td><td><b>30</b></td></tr>

<tr><td style="width: 150px;"># of Units:</td><td><b>561</b></td></tr>

I want to extract:-

Development Name Property Type Developer Tenure Floors Units

I am using this xpath, but its not working . Please help

'//tr//td[@style="width: 150px;" and text()="Development Name:"]//td//b'

Parsing option and optgroup in XML with PHP

I have an xml file that defines form fields. In the case of a list with optgroups, my xml would contain something like

<field
    name="expertise"
    type="multilist"
    label="Area of Expertise"
>
    <option value="Disaster Management">Disaster Management </option>
    <option value="Energy Security">Energy Security </option>
    <optgroup label="Environment">
        <option value="Climate">Climate </option>
        <option value="Resource Security">Resource Security </option>
    </optgroup>
</field>

I am trying to loop through nodes such as

foreach ($feed->fieldset[1]->field[$j]->children() as $c):
    foreach($c->attributes() as $key => $value):
        echo '<'.$c->getName().' '.$key.'="'.$value.'">'.$c.'</'.$c->getName().'><br>';
    endforeach;
endforeach;

I know, probably doesn't make sense for the value to equal the label, but I'll worry about that later.

For now, I am trying to figure out how to loop through both the options and the options within an optgroup. Above loop is not showing the optgroup's options (as expected). Seems I probably have to do some recursion, but was wondering if there are better ways you might recommend, such as existing php xml functions that handle what I am trying to do (so far I have not found anything).

Thanks!

Compare and Merging two XML "STRINGS" in java

I want to compare and merge 2 XML formats in JAVA which is stored as strings. I want to merge the strings and give the output as a single XML format. I want to compare unique IDs in both XML strings and merge each record accordingly.For example if i have product ID, product name, product description in one XML and product ID, number of stocks in the other XML ,I want to compare product IDs in both XML and if they are same, then I want output in the format which has: product ID, product name, product description, number of stocks for each record.Please guide me with a sample code for this in Java. There shouldn't be any loop statement for this comparing and merging.

WPF trigger event by clicking on specified content of SelectedItem in ListBox

I have template for ListBoxItems that contains 3 columns. Each item is represented by picture-text-picture. Is there some posibillity how to trigger event (for example PreviewMouseLeftButtonDown) only by clicking on third column in ListBoxItem (not enywhere else on item).

I know how to trigger it by clicking on whole ListBoxItem, but i need it to trigger only when clicked on the last column (picture). Thanks.

<ListBox.ItemTemplate>
 <DataTemplate>
   <Grid Margin="0,4,0,4">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="20" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="20" />
       </Grid.ColumnDefinitions>
       <Image Source="images/showFile.png" Grid.Column="0" Height="16" Width="16"/>
       <TextBlock Text="{Binding Name}" Grid.Column="1"/>
       <Image Source="images/delete.png" Grid.Column="2" Height="16" Width="16"/>                        
  </Grid>
 </DataTemplate>
</ListBox.ItemTemplate>   

JAXB support for SOAP style arrayType

I'm trying to make a new version of a server that previously used Axis 1.4 to respond to SOAP RPC requests using Spring-WS. I have a few of the RPC calls working, but I'm stuck trying to satisfy a request that expects a SOAP body that looks like this:

<rpcCallResponse soapenv:encodingStyle="http://ift.tt/wEYywg">
   <responseElement soapenc:arrayType="xsd:string[5]" 
        xsi:type="soapenc:Array" 
        xmlns:soapenc="http://ift.tt/wEYywg">
      <responseElement xsi:type="xsd:string">val1</responseElement>
      <responseElement xsi:type="xsd:string">val2</responseElement>
      <responseElement xsi:type="xsd:string">val3</responseElement>
      <responseElement xsi:type="xsd:string" xsi:nil="true"/>
      <responseElement xsi:type="xsd:string" xsi:nil="true"/>
   </responseElement>
</rpcCallResponse>

I'm struggling to write the XML schema for this, and to get the JAXB marshaller to shove the xsi:type annotations into the response.

What's the correct XML schema to use/set of annotations to use to get this to marhsal (Java -> XML) correctly?

Cannot resolve definition within WSDL in eclipse, possible eclipse import error?

After initially loading a completed project into eclipse for a change I'm getting an error on 3 components within a contained WSDL.

Error

"src-resolve: Cannot resolve the name 'tns:AEExceptionBO' to a(n) 'type >definition' component."


The three elements
*submitCallFault1_submitCallFault
*getOutageStatusFault1_getOutageStatusFault
*getOutageCircuitFault1_getOutageCircuitFault

As far as I can tell the import that currently exists (line 8 of wsdl) should load the xsd file correctly, no other errors exist in the project. Does anyone know why eclipse isn't able to process this wsdl?

WSDL (relevant parts)

<wsdl:definitions name="AEAdmsAecServiceDelegate"
    targetNamespace="http://ift.tt/1KToYXY"
    xmlns:tns="http://ift.tt/1KToYXY" 
    xmlns:wsdl="http://ift.tt/LcBaVt"
    xmlns:xsd="http://ift.tt/tphNwY">
    <wsdl:types>
        <xsd:schema targetNamespace="http://ift.tt/1KToYXY">
            <xsd:import namespace="http://ift.tt/1KToYY0"
                schemaLocation="wsdl/AEAdmsAecService/AEExceptionBO.xsd" />
            <xsd:element name="submitCallFault1_submitCallFault"
                nillable="true" type="bons0:AEExceptionBO" />
            <xsd:element name="getOutageStatusFault1_getOutageStatusFault"
                nillable="true" type="bons0:AEExceptionBO" />
            <xsd:element name="getOutageCircuitFault1_getOutageCircuitFault"
                nillable="true" type="bons0:AEExceptionBO" />
         </xsd:schema targetNamespace>

XSD (in a subdirectory, imported by the WSDL)

<xsd:schema targetNamespace="http://ift.tt/1KToYY0"
    xmlns:bons0="http://ift.tt/1KToYY0"
    xmlns:xsd="http://ift.tt/tphNwY">
    <xsd:include schemaLocation="NameValueBO.xsd" />
    <xsd:complexType name="AEExceptionBO">
        <xsd:sequence>
            <xsd:element minOccurs="1" name="appName" type="xsd:string" />
            <xsd:element minOccurs="0" name="moduleName" type="xsd:string" />
            <xsd:element minOccurs="1" name="errorCode" type="xsd:string">
            </xsd:element>
            <xsd:element minOccurs="1" name="message" type="xsd:string" />
            <xsd:element minOccurs="1" name="exceptionTime" type="xsd:dateTime">
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="nameValues"
                type="bons0:NameValueBO">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

Irrelevant parts of the WSDL and other loaded xsd files have been omitted.

C# - ListView to XML with a SaveFileDialog

I am currently making a WinForms application where I have a ListView with a bunch of items. The columns are: Name, World, Vocation, Level and Status.

I want to save these to an XML file in this format:

<ArrayOfPerson>
    <Person>
        <Name>Bobby</Name>
        <World>Earth</World>
        <Vocation>Blabla</Vocation>
        <Level>Blablabla</Level>
        <Status>Online</Status>
    </Person>
    <Person>
        <Name>Jeff</Name>
        <World>Uranus</World>
        <Vocation>Blabla</Vocation>
        <Level>Blablabla</Level>
        <Status>Offline</Status>
    </Person>
</ArrayOfPerson>

And then also be able to load it into the ListView.

My current code looks like this and just saves to a file name "list.xml" in the same folder. Also, the file only outputs it in one line. Instead of nice lines in the XML file (easy to read) it is all mashed together on 1 or 2 lines, which can be quite difficult if I'd want to open the XML file in an editor.

How can I:

  1. Use a SaveFileDialog and choose filename for this

  2. Put 1 element on each line in the XML file, and not all together

  3. Add a OpenFileDialog and load each person into the list again

    public class Person { public string Name { get; set; } public string World { get; set; } public string Vocation { get; set; } public string Level { get; set; } public string Status { get; set; } }

    private void saveListToolStripMenuItem_Click(object sender, EventArgs e)
    {
        List<Person> people = new List<Person>();
        for (int i=0; i<characterList.Items.Count; i++)
        {
            string nameSave = characterList.Items[i].SubItems[0].Text;
            string worldSave = characterList.Items[i].SubItems[1].Text;
            string vocationSave = characterList.Items[i].SubItems[2].Text;
            string levelSave = characterList.Items[i].SubItems[3].Text;
            string statusSave = characterList.Items[i].SubItems[4].Text;
    
            people.Add(new Person { Name = nameSave, World = worldSave, Vocation = vocationSave, Level = levelSave, Status = statusSave });
        }
    
        using (var writer = XmlWriter.Create("list.xml"))
        {
            var serializer = new XmlSerializer(typeof(List<Person>));
            serializer.Serialize(writer, people);
        }
    
    }
    
    

I also provide a screenshot of how the list looks: enter image description here

SOAP service response cannot be mapped

This problem has had me stumped for almost two days now, I really need some help figuring it out.

I have used wsimport to generate code from two different .wsdl files for a Java project.

The first service works just fine but for some reason the response from the second service cannot be unmarshalled to a response object.

Working service:

@WebMethod(action = "[actionName]")
@WebResult(name = "getSimpleCompanyInfoResponse", partName = "getSimpleCompanyInfoResponse")
public GetSimpleCompanyInfoResponse getSimpleCompanyInfo(
        @WebParam(name = "getSimpleCompanyInfoRequest", partName = "getSimpleCompanyInfoRequest") GetSimpleCompanyInfoRequest getSimpleCompanyInfoRequest);

Response POJO:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getSimpleCompanyInfoResponse", propOrder = {
    //variables
})
public class GetSimpleCompanyInfoResponse {
    //variables
}

Response XML:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:ns1="[namespaceUri]" xmlns:xsi="http://ift.tt/ra1lAU">
    <SOAP-ENV:Body>
        <ns1:getSimpleCompanyInfoResponse>
            <getSimpleCompanyInfoResponse>
                //variables
            </getSimpleCompanyInfoResponse>
        </ns1:getSimpleCompanyInfoResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

NOT working service:

@WebMethod(operationName = "PersonnelInfo", action = "[actionName]")
@WebResult(name = "PersonnelInfoResponse", partName = "PersonnelInfoResponse")
public PersonnelInfoResponse personnelInfo(
@WebParam(name = "PersonnelInfoRequest", partName = "PersonnelInfoRequest") PersonnelInfoRequest personnelInfoRequest);

Response POJO:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PersonnelInfoResponse", propOrder = {
    //variables
})
public class PersonnelInfoResponse {
    //variables
}

Response XML:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:ns1="[namespaceUri]" xmlns:xsi="http://ift.tt/ra1lAU">
    <SOAP-ENV:Body>
        <ns1:PersonnelInfoResponse>
            //variables
        </ns1:PersonnelInfoResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Using -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true or monitoring with Wireshark I can see the Response envelope from the second service coming through just fine and unmarshalling doesn't throw any exceptions but in the end PersonnelInfoResponse is null.

The only difference I can see is that the second service response payload in the XML is missing the outer element which seems to be the problem. However, I do not know how to "fix" it so it doesn't look for the outer element.

If anything was unclear or missing please let me know and I'll try to give you all the information.

EDIT:

No, I unfortunately don't have any control over the service itself, I only have the .wsdl and .xsd.

I'm calling the service like this:

ReportsControllerPortType port = new ReportsControllerService().getReportsControllerPort();

PersonnelInfoRequest request = new PersonnelInfoRequest();
//fill the required fields in the request, username, password, etc.

PersonnelInfoResponse response = port.personnelInfo(request);

The client-side service stubs (ReportsControllerService & ReportsControllerPortType) are also automatically generated by wsimport according to the .wsdl and .xsd.

EDIT 2:

Removing the operation name doesn't work, the service fails to initialize. Following are the definitions from both .wsdl-s:

Working service:

<wsdl:message name="getSimpleCompanyInfoRequest">
    <wsdl:part name="getSimpleCompanyInfoRequest" type="tns:getSimpleCompanyInfoRequest" />
</wsdl:message>
<wsdl:message name="getSimpleCompanyInfoResponse">
    <wsdl:part name="getSimpleCompanyInfoResponse" type="tns:getSimpleCompanyInfoResponse" />
</wsdl:message>

<wsdl:portType name="MonitoringControllerPortType">
    <wsdl:operation name="getSimpleCompanyInfo">
        <wsdl:input message="tns:getSimpleCompanyInfoRequest" />
        <wsdl:output message="tns:getSimpleCompanyInfoResponse" />
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="MonitoringControllerBinding" type="tns:MonitoringControllerPortType">
    <soap:binding style="rpc" transport="http://ift.tt/LcBaVu" />

    <wsdl:operation name="getSimpleCompanyInfo">
        <soap:operation soapAction="[domain]/#getSimpleCompanyInfo" style="rpc" />
        <wsdl:input>
            <soap:body use="literal" namespace="[namespaceUri]" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" namespace="[namespaceUri]" />
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

<wsdl:service name="MonitoringControllerService">
    <wsdl:port name="MonitoringControllerPort" binding="tns:MonitoringControllerBinding">
        <soap:address location="[serviceUri]" />
    </wsdl:port>
</wsdl:service>

Not working service:

<wsdl:message name="PersonnelInfoRequest">
    <wsdl:part name="PersonnelInfoRequest" type="tns:PersonnelInfoRequest" />
</wsdl:message>
<wsdl:message name="PersonnelInfoResponse">
    <wsdl:part name="PersonnelInfoResponse" type="tns:PersonnelInfoResponse" />
</wsdl:message>

<wsdl:portType name="ReportsControllerPortType">
    <wsdl:operation name="PersonnelInfo">
        <wsdl:input message="tns:PersonnelInfoRequest" />
        <wsdl:output message="tns:PersonnelInfoResponse" />
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="ReportsControllerBinding" type="tns:ReportsControllerPortType">
    <soap:binding style="rpc" transport="http://ift.tt/LcBaVu" />
    <wsdl:operation name="PersonnelInfo">
        <soap:operation soapAction="[domain]/#PersonnelInfo" style="rpc" />
        <wsdl:input>
            <soap:body use="literal" namespace="[namespaceUri]" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" namespace="[namespaceUri]" />
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

<wsdl:service name="ReportsControllerService">
    <wsdl:port name="ReportsControllerPort" binding="tns:ReportsControllerBinding">
        <soap:address location="[serviceUri]" />
    </wsdl:port>
</wsdl:service>

EDIT 3:

ReportsControllerService and MonitoringControllerService extend javax.xml.ws.Service and contain the definitions of the .wsdl schema location and namespace used. The service class returns a PortType object as you can see:

/**
 * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b130926.1035 Generated source version: 2.2
 */
@WebServiceClient(name = "ReportsControllerService", targetNamespace = "[namespaceUri]", wsdlLocation = "[wsdlUri]")
public class ReportsControllerService extends Service {

    @WebEndpoint(name = "ReportsControllerPort")
    public ReportsControllerPortType getReportsControllerPort() {
        return super.getPort(new QName("[namespaceUri]", "ReportsControllerPort"), ReportsControllerPortType.class);
    }
}

ReportsControllerPortType is an interface which contains methods for every operation endpoint that exists in the service

/**
 * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b130926.1035 Generated source version: 2.2
 */
@WebService(name = "ReportsControllerPortType", targetNamespace = "[namespaceUri]")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@XmlSeeAlso({ObjectFactory.class})
public interface ReportsControllerPortType {

    @WebMethod(operationName = "PersonnelInfo", action = "[actionName]")
    @WebResult(name = "PersonnelInfoResponse", partName = "PersonnelInfoResponse")
    public PersonnelInfoResponse personnelInfo(
        @WebParam(name = "PersonnelInfoRequest", partName = "PersonnelInfoRequest") PersonnelInfoRequest personnelInfoRequest);
    }
}

The thing is, all of those classes are automatically generated by JAX-WS (as you can see from the comments) based on the .wsdl schema. The implementation is abstracted somewhere inside the JDK and I don't have control over that either. Yes, I can refactor the code so I bypass JAX-WS but as I understand it, this is supposed to be like a de facto standard way to consume .wsdl-based SOAP services.

The project uses Spring as a base-framework and I have already confirmed both services will work when I use Spring-WS instead so I can refactor but I want to understand why this way isn't working.

PHP Append XML document with namespaces

I'm trying to parse docx files in PHP. Now I want to append document.xml file (that is main part of unzipped docx file). The structure is:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <w:document xmlns:wpc="http://ift.tt/JiuBoL"
xmlns:mc="http://ift.tt/pzd6Lm"                               xmlns:w="http://ift.tt/JiuBoE"             
mc:Ignorable="w14 wp14">
        <w:body>
            <w:p w:rsidR="00080C51" w:rsidRDefault="00080C51">
                <w:pPr>
                    <w:pStyle w:val="a3"/>
                    <w:ind w:left="1020"/>
                    <w:rPr>
                        <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
                        <w:sz w:val="22"/>
                        <w:szCs w:val="22"/>
                    </w:rPr>
                </w:pPr>
                <w:bookmarkStart w:id="0" w:name="_GoBack"/>
                <w:bookmarkEnd w:id="0"/>
            </w:p>
            <w:sectPr w:rsidR="00080C51">
                <w:pgSz w:w="11906" w:h="16838"/>
                <w:pgMar w:top="850" w:right="850" w:bottom="850" w:left="1417" w:header="708" w:footer="708" w:gutter="0"/>
                <w:cols w:space="708"/>
                <w:docGrid w:linePitch="360"/>
            </w:sectPr>
        </w:body>
    </w:document>

What I want to do is add new child <w:p>some text</w:p> tag to <w:body> tag. How can I do this?

There're a lot of ways to work with XML documents in PHP, like DOM, SimpleXMLElement. But which one can help me achieve this?

Android RadioGroup Cannot resolve symbol getCheckedRadioButtonId

I am new to android. At the moment I am working on some examples in my starter book "Android 5"

In the example I am working there is some code which is not working.

XML:

<RadioGroup
        android:id="@+id/rg_art"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <RadioButton
            android:id="@+id/rb_art_netto"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/txt_netto"
            android:textSize="16dp"
            android:checked="true" />

        <RadioButton
            android:id="@+id/rb_art_brutto"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/txt_brutto"
            android:textSize="16dp" />
    </RadioGroup>

Activity:

package com.example.raven.tax_calc;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioGroup;

public class FormularActivity extends Activity {

    public static final String BETRAG_KEY = "betrag";
    public static final String BETRAG_ART = "art";
    public static final String UST_PROZENT = "ust";

    // Betrag
    public void onClickBerechnen(View button) {
        final EditText txtBetrag = (EditText) findViewById(R.id.edt_betrag);
        final String tmpBetrag = txtBetrag.getText().toString();
        float betrag = 0.0f;
        if(tmpBetrag.length() > 0 ){
            betrag = Float.parseFloat(tmpBetrag);
        }
    }

    // Art des Betrages (Brutto, Netto)
    boolean isNetto = true;
    final RadioGroup rg = (RadioGroup) findViewById(R.id.rg_art);
    switch (rg.getCheckedRadioButtonId()) {
        case R.id.rb_art_netto:
            isNetto = "true";
            break;
        case R.id.rb_art_brutto:
            isNetto = false;
            break;
        default:
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.formular_activity);
    }
}

rg.getCheckedRadioButtonId is red highlighted and mouse-over says "Cannot resolve symbol"

What am I doing wrong? Can't find an mistake :-(

Why my XMLEventWriter don't write anything?

I am trying to make a filter but my XMLStreamWriter object seems not to write anything, even to System.out.

public static void main(String... args) throws FileNotFoundException, XMLStreamException {
    //FileOutputStream outputFile = new FileOutputStream("C:\\Users\\Badescu\\Desktop\\outFile.xml");
    XMLOutputFactory outputFactory =  XMLOutputFactory.newInstance();
    XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(System.out);
    //eventWriter = new IndentingXMLEventWriter(eventWriter); // error "IndentingXMLEventWriter cannot be resolved to a type"
    XMLEventFactory eventFactory = XMLEventFactory.newInstance();
    eventWriter.add(eventFactory.createStartDocument());
    eventWriter.add(eventFactory.createStartElement("", "", "a"));
    eventWriter.add(eventFactory.createStartElement("", "", "b"));
    eventWriter.add(eventFactory.createEndElement("", "", "b"));
    eventWriter.add(eventFactory.createEndElement("", "", "a"));
    eventWriter.add(eventFactory.createEndDocument());
}

If I uncomment the line where I've declared the "outputFile" it creates the file but it is empty. The filter that I want to create is the one that can be applied to my previvous question: "Extract specific elements from an input file and write them to an output file using StAX"