summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/find_policy.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/test/find_policy.c b/test/find_policy.c
index 9549fdf..b5c8a63 100644
--- a/test/find_policy.c
+++ b/test/find_policy.c
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <axiom_stax_builder.h>
-#include <axiom_document.h>
-#include <axiom_node.h>
-#include <axiom_element.h>
-#include <axiom_text.h>
-#include <axiom_data_source.h>
-#include <axutil_stream.h>
-#include <axutil_log_default.h>
-#include <axutil_error_default.h>
-#include <axiom_xml_reader.h>
-#include <stdio.h>
-#include <axiom_xml_writer.h>
-#include <axutil_env.h>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axiom_stax_builder.h>
+#include <axiom_document.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+#include <axiom_text.h>
+#include <axiom_data_source.h>
+#include <axutil_stream.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_xml_reader.h>
+#include <stdio.h>
+#include <axiom_xml_writer.h>
+#include <axutil_env.h>
axiom_node_t * return_policy_element(axis2_char_t * name,
const axutil_env_t * env,
axis2_char_t * wsdl_name);
@@ -38,12 +38,12 @@
const axutil_env_t * env,
axutil_array_list_t * policy_node_list,
axis2_char_t * wsdl_name);
-
-/**
- Define the environment related variables globaly so that they are available
- for both functions
-*/
+
+/**
+ Define the environment related variables globaly so that they are available
+ for both functions
+*/
axutil_allocator_t * allocator = NULL;
axutil_env_t * environment = NULL;
axutil_stream_t * stream = NULL;
@@ -51,14 +51,14 @@
axutil_log_t * axis_log = NULL;
FILE * f = NULL;
FILE * o = NULL;
-
-/** a method that demonstrate creating a om model using an xml file */
+
+/** a method that demonstrate creating a om model using an xml file */
int AXIS2_CALL
read_input(
char *buffer,
int size,
- void *ctx)
+ void *ctx)
{
int len = 0;
char *pos = NULL;
@@ -66,17 +66,17 @@ read_input(
if (buffer)
pos = strstr(buffer, "---");
if (pos)
-
+
{
len = pos - buffer;
*pos = '\0';
}
return len;
}
- int
+ int
main(
int argc,
- char *argv[])
+ char *argv[])
{
axutil_qname_t * qname = NULL;
axiom_node_t * policy_node = NULL, *node = NULL;
@@ -96,8 +96,8 @@ main(
environment =
axutil_env_create_with_error_log(allocator, error, axis_log);
policy_array = axutil_array_list_create(environment, 10);
-
- /*get all the policy values of "Binding_2B"*/
+
+ /*get all the policy values of "Binding_2B"*/
get_all_policy("Binding-2B", environment, policy_array, file_name);
node =
(axiom_node_t *) axutil_array_list_get(policy_array, environment, 2);
@@ -111,10 +111,10 @@ main(
axiom_node_serialize(node, environment, om_output);
buffer = (axis2_char_t *) axiom_xml_writer_get_xml(writer, environment);
if (buffer)
-
+
{
-
- /*printf(outfilename);*/
+
+ /*printf(outfilename);*/
o = fopen("C:\\OMWsdl\\wsdltest\\debug\\out.xml", "w");
if (!o)
return -1;
@@ -130,7 +130,7 @@ main(
axiom_node_t * return_policy_element(axis2_char_t * name,
const axutil_env_t * env,
- axis2_char_t * wsdl_name)
+ axis2_char_t * wsdl_name)
{
axiom_element_t * ele1 = NULL, *ele2 = NULL;
axiom_document_t * document = NULL;
@@ -152,14 +152,14 @@ main(
axiom_xml_reader_create_for_io(environment, read_input, NULL, NULL,
NULL);
if (!reader)
-
+
{
printf("ERROR CREATING PULLPARSER");
return NULL;
}
builder = axiom_stax_builder_create(environment, reader);
if (!builder)
-
+
{
printf("ERROR CREATING PULL PARSER");
return NULL;
@@ -169,34 +169,34 @@ main(
return NULL;
node1 = axiom_document_get_root_element(document, environment);
if (!node1)
-
+
{
printf(" root element null ");
axiom_stax_builder_free(builder, environment);
return NULL;
}
-
+
do
-
+
{
node2 = axiom_document_build_next(document, environment);
if (!node2)
break;
if (axiom_node_get_node_type(node2, environment) == AXIOM_ELEMENT)
-
+
{
ele2 =
(axiom_element_t *) axiom_node_get_data_element(node2,
environment);
attr_hash = axiom_element_get_all_attributes(ele2, environment);
if (attr_hash)
-
+
{
hi = axutil_hash_first(attr_hash, environment);
axutil_hash_this(hi, NULL, NULL, &attr);
if (axutil_strcmp
(axiom_attribute_get_value(attr, environment), name) == 0)
-
+
{
policy_node = node2;
}
@@ -207,7 +207,7 @@ main(
return policy_node;
}
- axis2_char_t * get_policy_ref(axiom_node_t * node, const axutil_env_t * env)
+ axis2_char_t * get_policy_ref(axiom_node_t * node, const axutil_env_t * env)
{
axiom_element_t * policy_element = NULL;
axiom_children_iterator_t * children_iter = NULL;
@@ -220,11 +220,11 @@ main(
(axiom_element_t *) axiom_node_get_data_element(node, env);
children_iter = axiom_element_get_children(policy_element, env, node);
while (axiom_children_iterator_has_next(children_iter, env))
-
+
{
child_node = axiom_children_iterator_next(children_iter, env);
if (axiom_node_get_node_type(child_node, environment) == AXIOM_ELEMENT)
-
+
{
policy_element =
(axiom_element_t *) axiom_node_get_data_element(child_node,
@@ -232,14 +232,14 @@ main(
if (axutil_strcmp
(axiom_element_get_localname(policy_element, environment),
"PolicyReference") == 0)
-
+
{
qname = axutil_qname_create(environment, "URI", NULL, NULL);
attr =
axiom_element_get_attribute(policy_element, environment,
qname);
if (attr)
-
+
{
value = axiom_attribute_get_value(attr, environment);
val = axutil_string_substring_starting_at(value, 1);
@@ -255,7 +255,7 @@ get_all_policy(
axis2_char_t * element_name,
const axutil_env_t * env,
axutil_array_list_t * policy_node_list,
- axis2_char_t * wsdl_name)
+ axis2_char_t * wsdl_name)
{
axutil_hash_t * attr_hash = NULL;
axutil_hash_index_t * hi = NULL;
@@ -270,21 +270,21 @@ get_all_policy(
return_policy_element(get_policy_ref(parent_node, env), env, wsdl_name);
axutil_array_list_add(policy_node_list, env, parent_policy_node);
if (axiom_node_get_node_type(parent_node, env) == AXIOM_ELEMENT)
-
+
{
element =
(axiom_element_t *) axiom_node_get_data_element(parent_node, env);
attr_hash = axiom_element_get_all_attributes(element, env);
if (attr_hash)
-
+
{
hi = axutil_hash_next(env, axutil_hash_first(attr_hash, env));
-
+
do
-
+
{
if (hi)
-
+
{
axutil_hash_this(hi, NULL, NULL, &attribute);
attribute_val = axiom_attribute_get_value(attribute, env);